//创新创效最新
import React, {} from 'react';
import {
  View,
} from 'react-native';

import Config from '../../config';
import SizeUtils from '../../common/SizeUtils';
import {DateUtils} from '../../utils/Utils';
import CommonStyles from '../../common/CommonStyles';
import BaseComponent from '../common/BaseComponent';
import CommonDataListView from '../common/CommonDataListView';
import WH_PostItemView from './WH_PostItemView';
import WH_RequestPostsAction from '../../actions/workhard/WH_RequestPostsAction';

export default class WH_IndexHotView extends BaseComponent {
  constructor(props) {
    super(props);

    this._listView = null;
  }

  render() {
    return (
      <View style={{backgroundColor:"#ffffff00",
          paddingTop:SizeUtils.translateDesignHeightToCode(20)}}>
        <CommonDataListView style={{width:SizeUtils.getWindowSize().width,
            height:SizeUtils.getWindowSize().height - SizeUtils.translateDesignHeightToCode(20) - Config.paddingTop}}
          ref={(ref) => {this._listView = ref}}
          requestData = {this._requestData.bind(this)}
          onRenderItem = {this._onRenderItem.bind(this)}
          dataKey = {"post_id"}
        />
      </View>
    )
  }
  refRefresh(){
    this.doRefresh();
  }
  _onRenderItem(data, index) {
    return (<WH_PostItemView refRefresh={this.refRefresh.bind(this)} data={data} showTop={true} />)
  }

  _requestData(page, listView) {
    new WH_RequestPostsAction().call(listView, {sort_id:2, tag:1, page:page, page_size:10, show_last_days:7});
  }
}
